using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class BatchMap : EntityTypeConfiguration<Batch>
	{
		public BatchMap()
		{
			// Primary Key
			this.HasKey(t => t.BatchID);

			// Properties
			this.Property(t => t.BatchNO)
				.IsRequired()
				.HasMaxLength(20);
				
			this.Property(t => t.CarNO)
				.HasMaxLength(10);
				
			// Table & Column Mappings
			this.ToTable("Batch");
			this.Property(t => t.BatchID).HasColumnName("BatchID");
			this.Property(t => t.BatchNO).HasColumnName("BatchNO");
			this.Property(t => t.Amount).HasColumnName("Amount");
			this.Property(t => t.PackageNum).HasColumnName("PackageNum");
			this.Property(t => t.Weight).HasColumnName("Weight");
			this.Property(t => t.Operator).HasColumnName("Operator");
			this.Property(t => t.OperTime).HasColumnName("OperTime");
			this.Property(t => t.OperStation).HasColumnName("OperStation");
			this.Property(t => t.ReceiveBy).HasColumnName("ReceiveBy");
			this.Property(t => t.ReceiveTime).HasColumnName("ReceiveTime");
			this.Property(t => t.ReceiveStation).HasColumnName("ReceiveStation");
			this.Property(t => t.Driver).HasColumnName("Driver");
			this.Property(t => t.CarNO).HasColumnName("CarNO");
			this.Property(t => t.CreatBy).HasColumnName("CreatBy");
			this.Property(t => t.CreatStation).HasColumnName("CreatStation");
			this.Property(t => t.CreatTime).HasColumnName("CreatTime");
			this.Property(t => t.UpdateBy).HasColumnName("UpdateBy");
			this.Property(t => t.UpdateStation).HasColumnName("UpdateStation");
			this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
			this.Property(t => t.IsDelete).HasColumnName("IsDelete");
			this.Property(t => t.IsSendEmail).HasColumnName("IsSendEmail");
		}
	}
}

